<template>
  <div id="app">
    <h3>欢迎光临_vue开发的收银系统_水果店</h3>
    <table class="tb">
      <tr>
        <td>苹果10￥/斤，折扣 8折</td>
      </tr>
      <tr>
        <td>请输入你要购买的斤数：<input type="text" v-model="count" /></td>
      </tr>
      <tr>
        <td><button @click="btn">结账买单~</button></td>
      </tr>
      <tr>
        <td>
          结账单：总价：{{ total }}￥元折后价：{{ after }}￥元省了{{ get }}￥元
        </td>
      </tr>
    </table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      count: "0",
      total: "0",
      after: "0",
      get: "0",
    };
  },
  methods: {
    btn() {
      this.total = this.count * 10;
      this.after = this.count * 8;
      this.get = this.total - this.after;
    },
  },
};
</script>

<style>
#app {
  width: 600px;
  margin: 10px auto;
}
h3 {
  text-align: center;
}
.tb {
  border-collapse: collapse;
  width: 100%;
}

.tb th {
  background-color: #0094ff;
  color: white;
}

.tb td,
.tb th {
  padding: 5px;
  border: 1px solid black;
  text-align: center;
}

.add {
  padding: 5px;
  border: 1px solid black;
  margin-bottom: 10px;
}
</style>